package com.qunchuang.controller;

import com.qunchuang.pojo.dto.AgvLiftStorageLocationDto;
import com.qunchuang.pojo.dto.AgvRequestLiftDto;
import com.qunchuang.pojo.vo.AssignmentLiftStorageLocationVo;
import com.qunchuang.pojo.vo.ResponseVo;
import com.qunchuang.service.AgvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/agv/storage")
public class AgvController {
    @Autowired
    private AgvService agvService;

    //agv到达电梯储位
    @PostMapping("/arrive")
    public ResponseVo agvArriveStorageLocation(@RequestBody AgvLiftStorageLocationDto Dto) throws InterruptedException {
        ResponseVo vo= agvService.agvArriveStorageLocation(Dto);
        return vo;
    }
    //agv离开电梯，释放电梯
    @PostMapping("/left")
    public ResponseVo agvLeaveLift(@RequestBody AgvLiftStorageLocationDto Dto) throws InterruptedException {
        ResponseVo vo= agvService.agvLeaveLift(Dto);
        return vo;
    }
    //agv异常，强制释放电梯
    @PostMapping("/force/release")
    public ResponseVo compulsionReleaseLift(@RequestBody AgvLiftStorageLocationDto Dto) throws Exception {
        ResponseVo vo= agvService.compulsionReleaseLift(Dto);
        return vo;
    }
}
